<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <p>省份名字</p>
        <input type="text" class="input1" v-model="">
    </div>
    <div>
        <p>城市名字</p>
        <input type="text" class="input2">
    </div>
    <button class="btn">查询</button>
    <ol>
        <li></li>
    </ol>
    <script src="./axios/axios.min.js"></script>
    <script>
        document.querySelector('.btn').addEventListener('click', function () {
            const pname = document.querySelector('.input1').value
            const cname = document.querySelector('.input2').value
            axios({
                url: 'http://hmajax.itheima.net/api/area',
                params: {
                    pname,
                    cname
                }
            }).then(res => {
                const list = res.data.list
                const newlist = list.map(item=>`<li>${item}</li>`).join('')
                document.querySelector('ol').innerHTML = newlist
            })

        })


    </script>
</body>

</html>